﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSell
{
    public partial class Admin : System.Web.UI.Page
    {
        DataObject dao = new DataObject();
        SeriCard seriCard = new SeriCard();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    if (Session["DN"] == null)
                    {
                        Response.Redirect("~/BauVatVTCGame.aspx");
                    }
                }
                catch (Exception ex)
                {
                    Response.Redirect("~/BauVatVTCGame.aspx");
                }
            }
        }

        private void LoadData()
        {
            GridData.DataSource = dao.GetAllSeriCard();
            GridData.DataBind();
        }

        protected void GridData_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridViewRow row = (GridViewRow)GridData.Rows[e.RowIndex];
            string loaithe = ((Label)row.FindControl("lblLoaiThe")).Text;
            string soSeri = ((Label)row.FindControl("lblSoSeri")).Text;
            string mavcoin = ((Label)row.FindControl("lblMavcoin")).Text;
            string taikhoan = ((Label)row.FindControl("lblTaiKhoan")).Text;
            seriCard.LoaiThe=loaithe;
            seriCard.SoSeri=soSeri;
            seriCard.MaVcoin=mavcoin;
            seriCard.TaiKhoan=taikhoan;

            dao.DeleteSericard(seriCard);
            LoadData();
        }

    }
}